package com.ai.demo.controller;

import com.ai.demo.entity.Course;
import com.ai.demo.service.ICourseService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequiredArgsConstructor
@RestController
public class HelloController {

    private final ICourseService courseService;

    @GetMapping("/hello")
    public String hello() {
        return "hello world";
    }

    @GetMapping("/test")
    public String test() {
        List<Course> courses = courseService.query().list();
        for (Course course : courses) {
            System.out.println(course.getName());
        }
        return "查询成功";
    }

}
